<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <!-- <el-row>
        <el-col :span="6">
          <el-input></el-input>
        </el-col>
        <el-col :span="3">
          <el-button icon="el-icon-search"></el-button>
        </el-col>
      </el-row> -->
      <el-row>
        <el-col :span="6">
          <el-input>
            <el-button slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </el-col>
      </el-row>
      <el-table :data="tableList" border stripe>
        <el-table-column type="index"></el-table-column>
        <el-table-column label="订单编号" prop="order_number"></el-table-column>
        <el-table-column label="订单价格" prop="order_price"></el-table-column>
        <el-table-column label="是否付款">
          <template slot-scope="scope">
            <!-- {{ scope.row.order_pay === '0' ? '否' : '是' }} -->
            <el-tag v-if="scope.row.order_pay === '1'" type="success"
              >已付款</el-tag
            >
            <el-tag v-else type="danger">未付款</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="是否发货" prop="is_send"></el-table-column>
        <el-table-column label="下单时间">
          <template slot-scope="scope">
            {{ scope.row.create_time | dataFormat }}
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template>
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-edit"
            ></el-button>
            <el-button
              size="mini"
              type="success"
              @click="logisticsClick"
              icon="el-icon-check"
            ></el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 展示物流进度的对话框 -->
      <el-dialog title="物流信息" :visible.sync="logisticsDia" width="40%">
        <el-timeline>
          <el-timeline-item
            v-for="(activity, index) in logisticsList"
            :key="index"
            :timestamp="activity.time"
          >
            {{ activity.context }}
          </el-timeline-item>
        </el-timeline>
        <span slot="footer" class="dialog-footer">
          <el-button @click="logisticsDia = false">取 消</el-button>
          <el-button type="primary" @click="logisticsDia = false"
            >确 定</el-button
          >
        </span>
      </el-dialog>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryInfo: {
        pagenum: 1,
        pagesize: 10
      },
      tableList: [],
      total: 0,
      logisticsDia: false,
      logisticsList: []
    }
  },
  created() {
    this.getData()
    this.getlogisticsData()
  },
  methods: {
    getData() {
      this.$http
        .get('orders', {
          params: this.queryInfo
        })
        .then((res) => {
          const list = res.data.data
          this.tableList = list.goods
          this.total = list.total
        })
    },
    logisticsClick() {
      this.logisticsDia = true
    },
    async getlogisticsData() {
      const { data: res } = await this.$http.get('/kuaidi/1106975712662')
      if (res.meta.status === 200) {
        this.logisticsList = res.data
        console.log(this.logisticsList)
      }
      // this.$http.get('/kuaidi/1106975712662').then((res) => {
      //   console.log(res.data)
      // })
    }
  }
}
</script>

<style scoped>
</style>
